package test8;

import java.util.HashSet;
import java.util.Scanner;
import java.util.Set;
import java.util.TreeSet;

public class test8_2 {
	public static void main(String[] args){
	Set<String> set=new TreeSet<String>();
	Scanner sr=new Scanner(System.in);
	int count=0;
	String words=sr.next();

	while(!words.equals("!!!!!")){
		set.add(words);
		words=sr.next();
	}
	
	System.out.println(set.size());
	for(String e: set){
		count++;
		System.out.println(e);
		if(count>=10)
		break;
	}
	
	}	
}
